package com.zx.frpc.controller;

import com.zx.frpc.model.Common;
import com.zx.frpc.service.frpCommonService;
import com.zx.frpc.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @ClassName: frpController
 * @Author: Zx
 * @Date: 2021/9/1 7:01 下午
 * @Version: v1.0
 */
@Controller
@RequestMapping("/frpc/common")
public class FrpcCommonController {

    @Autowired
    private frpCommonService frpCommonService;

    @RequestMapping()
    public String common(){
        return "frp/common";
    }

    @RequestMapping("/get")
    @ResponseBody
    public Result get(){ return frpCommonService.get();}


    //☞修改
    @RequestMapping(value = "/update", method = RequestMethod.POST)
    @ResponseBody
    public Result update(Common project) {
        try {
            return frpCommonService.update(project);
        } catch (Exception e) {
            return Result.build(500, e.getMessage().toString());
        }
    }

}
